home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
timing.arc
/
TIMETEST.BAS
< prev
next >
Wrap
BASIC Source File
|
1987-10-01
|
2KB
|
47 lines
'*** This program does nothing more than demonstrate the two timing
'*** SubPrograms, DELAY & BGDELAY
'*** First, the simpler DELAY. This SubProgram is CALLed with one
'*** SINGLE PRECISION (*!*) argument and retains control until that
'*** many hundredths of seconds pass.
color 14 :print "First test: `hard' delay"
color 7 :print " how many hundredths of seconds? :";
locate ,,1 :line input tmp$
print " Starting time: ";time$
time.to.wait! = val(tmp$) 'wait for 5 seconds
call delay(time.to.wait!)
print " Ending time : ";time$
'*** Next, BGDELAY. This SubProgram is CALLed with two SINGLE PRECISION (*!*)
'*** arguments, and one integer argument: the first S.P. argument tells
'*** BGDELAY how many hundredths of seconds are to be delayed; the second
'*** S.P. argument is for BGDELAY to tell you how many hundredths of
'*** seconds remain until the timeout has occurred. The third argument, the
'*** integer, tells you whether or not the timing is continuing. Once the
'*** third argument falls to 0, the timing is done (ie, a timeout has
'*** occurred) less than or equal to 0, then the timeout has occurred!
print
color 14 :print "Next test: `background' delay"
color 7 :print " how many hundredths of seconds? :";
locate ,,1 :line input tmp$
print " Starting time: ";time$
time.to.wait! = val(tmp$) 'wait for 5 seconds
do
gosub mything 'go do your thing while waiting
call bgdelay (time.to.wait!,time.to.go!,st%)
loop until st%=0
print
print " Ending time : ";time$
end
mything:
'do anything you want here, but DON'T change the value of ST% !!
locate csrlin,1
print " Current time : ";time$,,"1/100 seconds left:";fix(time.to.go!);
return